/**
 * 投诉表
 */
package com.bys.ots.model;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.entity.StringEntity;

import java.io.*;
import java.net.URLDecoder;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author bairuihua
 * 2019/12/03
 */
public class Complaint implements Serializable {
    private static final long serialVersionUID = 1L;

    //投诉描述
    private String description;

    //投诉唯一标识号
    private String descriptionId;

    //投诉种类
    private Integer catalogId;

    //投诉作者Id
    private String authorId;

    //投诉时间
    private Date describeTime;

    //投诉是否被删除
    private Integer isDeleted;

    private String so;

    private String aliaName;

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDescriptionId() {
        return descriptionId;
    }

    public void setDescriptionId(String descriptionId) {
        this.descriptionId = descriptionId;
    }

    public Integer getCatalogId() {
        return catalogId;
    }

    public void setCatalogId(Integer catalogId) {
        this.catalogId = catalogId;
    }

    public String getAuthorId() {
        return authorId;
    }

    public void setAuthorId(String authorId) {
        this.authorId = authorId;
    }

    public Date getDescribeTime() {
        return describeTime;
    }

    public void setDescribeTime(Date describeTime) {
        this.describeTime = describeTime;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public String getSo() {
        return so;
    }

    public void setSo(String so) {
        this.so = so;
    }

    public String getAliaName() {
        return aliaName;
    }

    public void setAliaName(String aliaName) {
        this.aliaName = aliaName;
    }

    @Override
    public String toString() {
        return "Complaint{" +
                "description='" + description + '\'' +
                ", descriptionId='" + descriptionId + '\'' +
                ", catalogId=" + catalogId +
                ", authorId='" + authorId + '\'' +
                ", describeTime=" + describeTime +
                ", isDeleted=" + isDeleted +
                ", so='" + so + '\'' +
                ", aliaName='" + aliaName + '\'' +
                '}';
    }


    public static void main(String[] args) throws UnsupportedEncodingException {
        Map <String,Object>map = new HashMap();



            map.put("Sale Rep Mapping.xlsx", "不存在");
        String jsonObject= JSONObject.toJSONString(map);
        StringEntity b=new StringEntity(jsonObject,"UTF-8");
        String a = "不存在";
        System.out.println(a.replace("???","不存在"));
        String ff="orderall.txt=2020-04-08+03%3A36%3A13.000&03_MSD-SO_APContact.txt=2020-04-08+08%3A00%3A45.000&06_MSD-SO_CSR.txt=2020-04-08+08%3A00%3A50.000&vw_division_rep_revenue.txt=2020-04-08+09%3A00%3A46.000&02_MSD-DN.txt=2020-04-08+08%3A00%3A48.000&01_MSD_OpenSO.txt=2020-04-08+08%3A01%3A10.000&04_MSD-SO_SalePerson.txt=2020-04-08+08%3A00%3A45.000&closeorder.txt=2020-04-08+04%3A36%3A02.000&05_MSD-SO_Shipto.txt=2020-04-08+08%3A00%3A45.000&Sale+Rep+Mapping.xlsx=2020-04-07+16%3A24%3A25.000&vw_division_rep_backlog.txt=2020-04-08+09%3A02%3A40.000\n";
        try {
            ff = URLDecoder.decode(ff, "utf-8");
            System.out.println(ff);

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        File file = new File("d:/home/ubuntu/SapTextData/" + "RecordDate.txt");
        try {
            if (!file.exists()) {
                File.createTempFile(file.getAbsolutePath() + file.getName(), null);
            }
            BufferedWriter writer = new BufferedWriter(new FileWriter(file, false));
            writer.write("fileName" + " " + "lastModifyDate" + "\r\n");
            for(String entry:ff.split("&")){
                writer.write(entry.split("=")[0] + "    " + entry.split("=")[1] + "\r\n");
            }
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}